package com.work.washer.controller;

import com.work.washer.model.Banner;
import com.work.washer.service.BannerService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author cys
 * @date 2024/5/17 17:35
 */
@Tag(name = "轮播图")
@RestController
@RequestMapping("/banner")
public class BannerController {

    @Autowired
    private BannerService bannerService;;


    /**
     * 查询所有
     *
     * @return 所有数据
     */
    @Operation(summary = "列表")
    @GetMapping("/list")
    public List<Banner> list() {
        List<Banner> list = bannerService.list();
        list.forEach(e->e.setImage("http://localhost:8080/erupt-attachment"+e.getImage()));
        return list;
    }



}
